<template>
    <div>
        <home-header></home-header>
        <home-swiper :swiperList="swiperList"></home-swiper>
        <home-icons :iconsList="iconsList"></home-icons>
        <home-recommend :recommendList="recommendList"></home-recommend>
        <home-weekend :weekendList="weekendList"></home-weekend>
    </div>
   
</template>

<script>
import HomeHeader from './components/Header.vue';
import HomeSwiper from './components/Swiper.vue';
import HomeIcons from './components/Icons.vue';
import HomeRecommend from './components/Recommend.vue';
import HomeWeekend from './components/Weekend.vue';
import axios from 'axios';

export default {
    name: 'Home',
    components: {
        HomeHeader,
        HomeSwiper,
        HomeIcons,
        HomeRecommend,
        HomeWeekend
    },
    data(){
        return {
            iconsList: [],
            swiperList: [],
            recommendList: [],
            weekendList: []
        }
    },
    methods: {
        getHomeData(){
            axios.get('/api/index.json').then(resolve => {
                const data = resolve.data.data;
                this.iconsList = data.iconsList;
                this.recommendList = data.recommendList;
                this.swiperList = data.swiperList;
                this.weekendList = data.weekendList;
            })
        }
    },
    mounted(){
        this.getHomeData();
    }
}
</script>

<style>
</style>